{include file="common/header"}
<div class="container">
    <form action="/GQT/public/index/sign/login" method="POST">
        <div class="form-group">
            <label for="exampleInputEmail1">姓名:</label>
            <input type="text" class="form-control" id="name" placeholder="张三" name="name">
        </div>
        <div class="form-group">
            <label for="exampleInputEmail1">学号:</label>
            <input type="text" class="form-control" id="stu_id" placeholder="165011100" name="stu_id">
        </div>
        <div class="form-group">
            <label for="exampleInputEmail1">班级:</label>
            <input type="text" class="form-control" id="class" placeholder="165011100" name="stu_id">
        </div>
        <div class="form-group">
            <label for="exampleInputPassword1">密码:</label>
            <input type="password" class="form-control" id="password" name="password">
        </div>
        <div class="form-group">
            <label for="exampleInputPassword1">再输一次:</label>
            <input type="password" class="form-control" id="agin-password" name="agin-password">
        </div>
        <div class="form-group">
            <label for="exampleInputPassword1">性别:</label>
            <label class="radio-inline">
                <input type="radio" name="sex" id="inlineRadio1" value="male"> 男
            </label>
            <label class="radio-inline">
                <input type="radio" name="sex" id="inlineRadio2" value="female"> 女
            </label>
        </div>

        <button type="submit" class="btn btn-default">提交</button>
    </form>
</div>
<script>
    $('#agin-password').blur(function () {
        var pwa = $(this)[0].value
        var pw = $('#password')[0].value
        if (pwa != pw) {
            alert("两次密码不一致")
        }
    })

    $('form').submit(function () {
        var pwa = $('#agin-password')[0].value
        var pw = $('#password')[0].value
        var name = $('#name')[0].value
        var class_stu = $('#class')[0].value
        var stu_id = $('#stu_id')[0].value
        var sex = $('input:radio:checked')
        if (pwa == "" || pw == "" || name == "" || stu_id == "" || class_stu== "" || sex.length == 0) {
            alert("请完善数据")
            return false;
        }
        if (pwa != pw) {
            alert("两次密码不一致")
            return false;
        }
        $.post('/GQT/public/sign/sign/login', { 'stu_id': stu_id, 'name': name, 'password': pw, 'sex': sex[0].value, 'class': class_stu}, function (data) {
            if(data==1){
                alert("注册成功")
                location.href='/GQT/public/index/sign/sign'
            }else{
                alert("注册失败")
            }
            console.log(data)
        })
        return false;




    })
</script> {include file="common/footer"}